#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+50;
const int M=7e5+50;
const ll INF=1e18+5;
ll n,m,k,u,v,s;
ll x,y;
inline ll read(){
   ll s=0;
   int w=1;
   char ch=getchar();
   while(ch<='0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
struct Edge{
    int v;
    ll w;
    int next;
}edge[M];
int cnt,head[N];
void init(){
    cnt=0;
    memset(head,-1,sizeof(head));
}
void addEdge(int u,int v,int w){
    edge[cnt]=Edge{v,w,head[u]};
    head[u]=cnt++;
    edge[cnt]=Edge{u,w,head[v]};
    head[v]=cnt++;
}
ll dis[N];
bool vis[N];
//1到i是否有铁路
bool train[N];
void spfa(){
    queue<int> q;
    //**
    //spfa的重点
    dis[1]=0;
    vis[1]=true;
    q.push(1);
    //**
    //pre
    while(k--){
        //scanf("%d%lld",&s,&y);
        s=read();
        y=read();
        if(y<dis[s]){
            dis[s]=y;
            train[s]=true;
            if(!vis[s]){
                vis[s]=true;
                q.push(s);
            }
        }
    }
    //spfa
    while(!q.empty()){
        int u=q.front();
        q.pop();
        vis[u]=false;
        for(int i=head[u];i!=-1;i=edge[i].next){
            int v=edge[i].v;
            int w=edge[i].w;
            //v能松弛而且有从1到v的的铁路
            //有铁路都不是最短路那当然可以删掉
            if(dis[v]>=dis[u]+w && train[v]){
                train[v]=false;
            }
            if(dis[v]>dis[u]+w){
                dis[v]=dis[u]+w;
                if(!vis[v]){
                    vis[v]=true;
                    q.push(v);
                }
            }
        }
    }
}
int main(void){
    scanf("%d%d%d",&n,&m,&k);
    init();
    while(m--){
        //scanf("%d%d%lld",&u,&v,&x);
        u=read();
        v=read();
        x=read();
        addEdge(u,v,x);
    }
    for(int i=1;i<=n;i++){
        dis[i]=INF;
    }
    int ans=k;
    spfa();
    for(int i=1;i<=n;i++){
        if(train[i]){
            ans--;
        }
    }
    printf("%d\n",ans);
    return 0;
}